home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / Gui4Cli / Docs / Tutorials / MouseData.gc < prev    next >
Encoding:
Gui4CLI script  |  1980-01-03  |  1.2 KB  |  50 lines

  1. G4C
  2.  
  3. ; ----- Obtaining feedback on mouse position and
  4. ;       the colour of the pixel clicked on
  5.  
  6. WinBig -1 -1 350 130 "MouseData.gc"
  7. WinType 11110001
  8. usetopaz
  9.  
  10. BOX 0 0 0 0 OUT RIDGE
  11.  
  12. ; ---- A box containing three cloured shapes
  13.  
  14. BOX 40 30 270 80 IN RIDGE
  15. SQUARE 60 40 40 60 1 FILL
  16. CIRCLE 175 70 60 30 2 FILL
  17. SQUARE 250 40 40 60 3 FILL
  18.  
  19. xonLoad 
  20. GuiOpen MouseData.gc
  21.  
  22. xonClose
  23. GuiQuit MouseData.gc
  24.  
  25. ; ---- Headings above the box
  26. Text 140 2 100 12 'MouseData' 9 NOBOX
  27. Text 90 16 200 12 'Click within the box' 20 NOBOX 
  28.  
  29. ; ---- Text gadgets to contain feedback below the box
  30. Text 50 114 50 12 '' 6 NOBOX
  31. gadid 1
  32. Text 125 114 50 12 '' 6 NOBOX
  33. gadid 2
  34. Text 200 114 50 12 '' 10 NOBOX
  35. gadid 3
  36.  
  37. ; ----- Marking the 'area' of the box serves two purposes :
  38. ;    1  Clicking within the area provides us with an 'event'
  39. ;       to which a reaction can be coded
  40. ;    2  It restricts events and feedback to the area required.
  41. ; We read the values of $$MOUSE.WX, $$MOUSE.WY, and $$MOUSE.COLOR
  42. ; to obtain the required information.
  43.  
  44. xArea 50 30 250 80 NONE
  45. update MouseData.gc 1 'X = $$MOUSE.WX'
  46. update MouseData.gc 2 'Y = $$MOUSE.WY'
  47. update MouseData.gc 3 'Colour = $$MOUSE.COLOR'
  48.  
  49. ; X and Y can also be obtained as SCREEN coordinates , but here
  50. ; we read only the window coordinates.